#include "upgradehelper.h"

#if defined(__linux__) || defined(__FreeBSD__)
#include <sys/types.h>
#include <sys/stat.h>
#endif
upgradeHelper::upgradeHelper(QObject *parent) : QThread(parent)
{

}

upgradeHelper::~upgradeHelper()
{

}

void upgradeHelper::run()
{
    //check /proc/scsi/usb-storage-# exist or not
#if defined(__linux__) || defined(__FreeBSD__)
    struct stat sb;
    if (stat("/proc/scsi/usb-storage", &sb) == -1) {
        needUpgrade(0);
    } else {
        //check ver.txt and fiapp file
        needUpgrade(1);
        system("mount /dev/sda /mnt");
    }
#endif
}
